package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import com.financing.wap.vo.admin.AdminUserComplainVO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserComplainDao;
import com.financing.wap.dto.DstUserComplainDTO;
import com.financing.wap.service.IDstUserComplainService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_complain  
 * 用户投诉记录 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserComplainService")
public class DstUserComplainServiceImpl implements IDstUserComplainService{

	@Autowired
	private IDstUserComplainDao dstUserComplainDao;

	@Override
	public int insert(DstUserComplainDTO dstUserComplain) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstUserComplain);
		DTOdateSetUtil.setUpdateInfo(dstUserComplain);
		dstUserComplain.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserComplainDao.insert(dstUserComplain);
	}

	@Override
	public void update(DstUserComplainDTO dstUserComplain) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserComplain);
		dstUserComplainDao.update(dstUserComplain);
	}

	@Override
	public void updateForce(DstUserComplainDTO dstUserComplain) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserComplain);
		dstUserComplainDao.updateForce(dstUserComplain);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserComplainDao.delete(id);
	}
	
	@Override
	public List<DstUserComplainDTO> queryList(DstUserComplainDTO dstUserComplain) throws SQLException {
		return dstUserComplainDao.queryList(dstUserComplain);
	}

	@Override
	public int queryListCount(DstUserComplainDTO dstUserComplain) throws SQLException {
		return dstUserComplainDao.queryListCount(dstUserComplain);
	}

	@Override
	public DstUserComplainDTO loadById(Integer id) throws SQLException {
		return dstUserComplainDao.loadById(id);
	}
 	@Override
	public DstUserComplainDTO queryListGetFirst(DstUserComplainDTO dstUserComplain)
			throws SQLException {
		 List<DstUserComplainDTO> queryList = queryList(dstUserComplain);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserComplainDTO();
		 }
		 return queryList.get(0);
	}

	@Override
	public int adminQueryListCount(AdminUserComplainVO userComplainVO) {
		return dstUserComplainDao.adminQueryListCount(userComplainVO);
	}

	@Override
	public List<AdminUserComplainVO> adminQueryList(AdminUserComplainVO userComplainVO) {
		return dstUserComplainDao.adminQueryList(userComplainVO);
	}
}
